<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../libs/vue.js"></script>
</head>
<body>
    <!-- 
        vue注册的事件获取事件对象方式：
            1.无需传参：在事件函数上写一个形参，这个形参就是事件对象
            2.需要传参: 传入实参$event,代表事件对象
     -->
    <div id="app">
        <h1>{{msg}}</h1>
        <!-- <button @click="updateMsg">点击修改msg</button> -->
        <button @click="updateMsg('666',$event)">点击修改msg</button>
        <input @keyup="getInput($event)" type="text">
    </div>
    <script>
        let vm = new Vue({
            el:'#app',
            data:{
                msg:'hello vue'
            },
            methods: {
                updateMsg(e,val){
                    console.log(e,val)
                    this.msg = '哈哈哈'
                },
                getInput(e){
                    if(e.keyCode === 13) {
                        console.log(e.target.value)
                    }
                }
            },
        })
    </script>
</body>
</html>